﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "IfcGeometryConvertContext.h"
#include "WeakPtr.h"
#include "WeakReferenceable.h"

namespace gcmp
{
    class IGraphicsElementShape;
    class IPolygon;
    class ILine3d;
    class IIfcEntity;
    class Vector2d;
    class Coordinate3d;

    /// \brief IFC几何转换器，提供几何转换相关接口
    class IIfcGeometryConverter:public WeakReferenceable
    {
    public:
        virtual ~IIfcGeometryConverter() {}

    public:
        /// \brief 转换GraphicsElementShape为IfcShapeRepresentation
        /// \param pGrep 被转换对象
        /// \param context 转换上下文
        /// \return 返回IFC普通实体对象指针
        ///注意：返回的对象Ifc类型为IfcShapeRepresentation，所有属性均由内部创建，不允许外部修改，对其调用SetAttribute无效；
        ///可以通过参数context中的ExportMode来选择导出IFC形体的模式
        virtual WeakPtr<IIfcEntity> ConvertGraphicsElementShape(const IGraphicsElementShape* pGrep, const IfcGeometryConvertContext& context) = 0;

        /// \brief 创建IfcLocalPlacement对象
        /// \param coord 局部坐标系
        /// \param iParentPlacementEntityId 父LocalPlacement对象的EntityId（-1代表没有父）
        /// \return 返回IFC普通实体对象指针        
        ///注意：父LocalPlacement对象必须也是3D，不能是2D
        virtual OwnerPtr<IIfcEntity> CreateLocalPlacement3D(const Coordinate3d& coord, int iParentPlacementEntityId = -1) = 0;

        /// \brief 创建IfcExtrudedAreaSolid(拉伸体)对象
        /// \param pProfile 轮廓线（以局部坐标系内的二维多边形表示，非三维世界坐标）
        /// \param pExtrusionPath 拉伸路径（只取方向和长度）
        /// \param coord 轮廓线所在局部坐标系        
        /// \return 返回IFC普通实体对象指针               
        virtual OwnerPtr<IIfcEntity> CreateExtrudedAreaSolid(const IPolygon* pProfile, const ILine3d* pExtrusionPath, const Coordinate3d& coord) = 0;
    };
}
